Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revoke installations #480

Merged
merged 5 commits into from
Aug 23, 2024
Merged

Revoke installations #480

merged 5 commits into from
Aug 23, 2024

Conversation

cameronvoell
Copy link
Contributor

@cameronvoell cameronvoell commented Aug 22, 2024

Adds the ability to revoke installations. See test for usage:

test('can revoke all other installations', async () => {
  const keyBytes = new Uint8Array([
    233, 120, 198, 96, 154, 65, 132, 17, 132, 96, 250, 40, 103, 35, 125, 64,
    166, 83, 208, 224, 254, 44, 205, 227, 175, 49, 234, 129, 74, 252, 135, 145,
  ])
  const alixWallet = Wallet.createRandom()

  const alix = await Client.create(alixWallet, {
    env: 'local',
    appVersion: 'Testing/0.0.0',
    enableV3: true,
    dbEncryptionKey: keyBytes,
  })
  await alix.deleteLocalDatabase()

  const alix2 = await Client.create(alixWallet, {
    env: 'local',
    appVersion: 'Testing/0.0.0',
    enableV3: true,
    dbEncryptionKey: keyBytes,
  })

  const inboxState = await alix2.inboxState(true)
  assert(
    inboxState.installationIds.length === 2,
    `installationIds length should be 2 but was ${inboxState.installationIds.length}`
  )

  await alix2.revokeAllOtherInstallations(alixWallet)

  const inboxState2 = await alix2.inboxState(true)
  assert(
    inboxState2.installationIds.length === 1,
    `installationIds length should be 1 but was ${inboxState2.installationIds.length}`
  )
  return true
})

@cameronvoell cameronvoell marked this pull request as ready for review August 23, 2024 00:47
@cameronvoell cameronvoell requested a review from a team as a code owner August 23, 2024 00:47
Copy link
Contributor

@nplasterer nplasterer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks for fixing this all up. Theres a Github lint error (that I actually think I introduced) do you mind fixing that in this pr. 🙏

@nmalzieu nmalzieu merged commit a29597e into main Aug 23, 2024
5 of 6 checks passed
@nmalzieu nmalzieu deleted the cv/revoke-installations branch August 23, 2024 09:01
Copy link

🎉 This PR is included in version 2.4.8 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants